package statistics.demo.statistics_demo;


import com.github.mikephil.charting.formatter.ValueFormatter;

/**
 * Created by 雷瞳 on 2019/11/30.
 */
public class HoursAxisValueFormatter extends ValueFormatter {
    private String[] mHours = new String[] {
            "0时",
            "1时",
            "2时",
            "3时",
            "4时",
            "5时",
            "6时",
            "7时",
            "8时",
            "9时",
            "10时",
            "11时",
            "12时",
            "13时",
            "14时",
            "15时",
            "16时",
            "17时",
            "18时",
            "19时",
            "20时",
            "21时",
            "22时",
            "23时",
            "24时"
    };

    @Override
    public String getFormattedValue(float value) {
        String formatString = "1";
        switch ((int) value) {
            case 0:
                formatString = mHours[0];
                break;
            case 6:
                formatString = mHours[6];
                break;
            case 12:
                formatString = mHours[12];
                break;
            case 18:
                formatString = mHours[18];
                break;
            case 24:
                formatString = mHours[24];
                break;
                default:
                    break;
        }
        return formatString;
    }
}
